﻿// --------------------------------
// <copyright file="TableColumnTest.cs" company="TRONSoft">
//     Copyright (c) TRONSoft.
// </copyright>
// <license>
//   This source code is subject to terms and conditions of the Microsoft
//   Public License. A copy of the license can be found in the License.html
//   file at the root of this distribution. If you cannot locate the
//   Microsoft Public License, please send an email to dlr@microsoft.com.
//   By using this source code in any fashion, you are agreeing to be bound 
//   by the terms of the Microsoft Public License. You must not remove this
//   notice, or any other, from this software.
// </license>
// <author>Tron</author>
// ---------------------------------

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Tronsoft.Actucal.Tables.Test
{  
    /// <summary>
    ///This is a test class for TableColumnTest and is intended
    ///to contain all TableColumnTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TableColumnTest
    {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        /// <summary>
        ///A test for DataType
        ///</summary>
        [TestMethod()]
        public void The_TableColumn_Should_Instantiated_Correctly()
        {
            TableColumn target = new TableColumn("name", typeof(int));

            Assert.AreEqual("name", target.ColumnName);
            Assert.AreEqual(typeof(int), target.DataType);
        }

        /// <summary>
        ///A test for TableColumn Constructor
        ///</summary>
        [TestMethod()]
        public void The_Name_Type_Constructor_Should_Work()
        {
            string name = "naam"; 
            Type type = typeof(string); 
            TableColumn target = new TableColumn(name, type);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentNullException))]
        public void The_Name_In_The_Constructor_Cannot_Be_Null_Or_Empty()
        {
            Type type = typeof(string);
            TableColumn target = new TableColumn(null, type);
            target = new TableColumn(string.Empty, type);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentNullException))]
        public void The_Type_In_The_Constructor_Cannot_Be_Null()
        {
            string name = "naam";
            Type type = null;
            TableColumn target = new TableColumn(name, type);
        }
    }
}
